<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加</title>
    <#assign base=request.contextPath  />
    <base id="base" href="${base}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, adminUser-scalable=0">
    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <script>
        var base =  "${base}";
    </script>
</head>
<body>
<br>
<form class="layui-form " action="">
          <div class="layui-form-item">
              <label class="layui-form-label">自我评价</label>
              <div class="layui-input-block">
                 <#-- <input type="text" id="evaluateText" name="evaluateText"   autocomplete="off" placeholder="请输入自我评价"
                         class="layui-input">-->
                  <textarea style="display: none;" id="evaluateText" name="evaluateText" lay-verify="content"></textarea>
              </div>
          </div>

    <div align="center">
        <button type="button" class="layui-btn" id="submit">保存</button>
    </div>
</form>

<script src="${base}/static/win10/component/layui/layui.js?t=1"></script>
<script src="${base}/static/win10/js/jquery-1.8.3.min.js?t=1"></script>
<script>
    layui.use(['form', 'layer','layedit'], function() {
        var form = layui.form
                , layer = layui.layer
                ,layedit = layui.layedit;

        var editIndex=layedit.build('evaluateText', {
            tool: ['left', 'center']
        }); //建立编辑器

        //自定义验证规则 同步富文本内容到textarea
        form.verify({
            content: function(value) {
                layedit.sync(editIndex);
            }
        });


            $("#submit").on("click",function () {
                var formDate = {
                    evaluateText: layedit.getText(editIndex)
                }
                //判断提交内容
                if(check(formDate.evaluateText)===false){
                    return;
                }

            $.ajax({
                type: "POST",
                url: base+"/WeChatUser/wechatEvaluate/admin/addWechatEvaluate",
                data: formDate,
                success: function (data) {
                    layer.msg(data.message)
                    if (data.code === 200) {
                        window.location.href=base+"/WeChatUser/wechatEvaluate/admin/main.html"
                    } else {

                    }
                }
            });
        })

        function check(vals){
                //去除输入空字符串或空格
            var vt = vals.trim().replace(/\s/g,"");
            //console.log(vt);
            if(vt.length<1){
                       layer.msg("请输入自我评价");
                       return false;
                   }
        }
    });


</script>
</body>
</html>